﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication.Models.ProductListWrapper>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Create</h2>

    <% using (Html.BeginForm()) {%>
      <%: Html.ValidationSummary(true) %>

      <fieldset>
          <legend>Create New Product</legend>
          <%= Html.ValidationSummary("Створення нового продукту було невдале. Будь-ласка виправте помилки і спробуйте ще раз.") %>
          <table>
            <tr>
              <td>Product Name</td>
              <td>
                <%: Html.TextBoxFor(model => model.product.ProductName) %>
                <%: Html.ValidationMessageFor(model => model.product.ProductName) %>
              </td>
            </tr>
            
            <tr>
              <td>Supplier Name</td>
              <td>
                <%: Html.DropDownListFor(model => model.SelectedSupplier, ViewData["suppliers"] as SelectList) %>
                <%: Html.ValidationMessageFor(model => model.SelectedSupplier)%>
              </td>
            </tr>
            
            <tr>
              <td>Category Name</td>
              <td>
                <%: Html.DropDownListFor(model => model.SelectedCategory, ViewData["categories"] as SelectList) %>
                <%: Html.ValidationMessageFor(model => model.SelectedCategory)%>
              </td>
            </tr>
            
            <tr>
              <td>Quantity per Unit</td>
              <td>
                <%: Html.TextBoxFor(model => model.product.QuantityPerUnit) %>
                <%: Html.ValidationMessageFor(model => model.product.QuantityPerUnit) %>
              </td>
            </tr>
            
            <tr>
              <td>Unit Price</td>
              <td>
                <%: Html.TextBoxFor(model => model.product.UnitPrice, new { Value = String.Format("{0:F2}", Model.product.UnitPrice) })%>
                <%: Html.ValidationMessageFor(model => model.product.UnitPrice) %>
              </td>
            </tr>
            
            <tr>
              <td>Units in Stock</td>
              <td>
                <%: Html.TextBoxFor(model => model.product.UnitsInStock) %>
                <%: Html.ValidationMessageFor(model => model.product.UnitsInStock) %>
              </td>
            </tr>
            
            <tr>
              <td>Units on Order</td>
              <td>
                <%: Html.TextBoxFor(model => model.product.UnitsOnOrder) %>
                <%: Html.ValidationMessageFor(model => model.product.UnitsOnOrder) %>
              </td>
            </tr>
            
            <tr>
              <td>Reorder Level</td>
              <td>
                <%: Html.TextBoxFor(model => model.product.ReorderLevel) %>
                <%: Html.ValidationMessageFor(model => model.product.ReorderLevel) %>
              </td>
            </tr>
            
            <tr>
              <td>Discontinued</td>
              <td>
                <%: Html.CheckBoxFor(model => model.product.Discontinued) %>
                <%: Html.ValidationMessageFor(model => model.product.Discontinued) %>
              </td>
            </tr>
          </table>    
      </fieldset>

      <p>
        <input type="submit" value="Create" />
        <%: Html.ActionLink("Back to List", "Index") %>
      </p>
    <% } %>
</asp:Content>

